import Vue from 'vue'
import App from './App.vue'

Vue.config.productionTip = false

import VueRouter from 'vue-router' // 引入 vue-router
import HmIndex from './pages/HmIndex.vue'
import HmLogin from './pages/HmLogin.vue'
import MianJing from './views/MianJing.vue'
import ShouCang from './views/ShouCang.vue'
import DianZan from './views/DianZan.vue'
import WoDe from './views/WoDe.vue'
import HmArticle from './views/HmArticle.vue'
import HmDetail from './pages/HmDetail.vue'

Vue.use(VueRouter) // 使用 vue-router

// 创建路由实例并配置路由表
const routes = [
  {
    path: '/index',
    component: HmIndex, // 示例组件
  },
  {
    path: '/',
    component: HmIndex, // 示例组件
    children: [
      {
        path: '/index/mianjing',
        component: MianJing,
        children: [
          {
            path: '/index/mianjing/hmarticle',
            component: HmArticle
          },
        ]
      },
      {
        path:'/index/shoucang',
        component: ShouCang,
        children: [
          {
            path: '/index/shoucang/hmarticle',
            component: HmArticle
          },
        ]
      },
      {
        path:'/index/dianzan',
        component: DianZan,
        children: [
          {
            path: '/index/dianzan/hmarticle',
            component: HmArticle
          },
        ]
      },
      {
        path:'/index/wode',
        component: WoDe
      },
      
    ]
  },
  {
    path: '/login',
    component: HmLogin 
  },
  {
    path: '/detail',
    component: HmDetail
  }
]

const router = new VueRouter({
  routes
})

new Vue({
  render: h => h(App),
  router // 挂载路由实例
}).$mount('#app')
